package com.itluma.myproject.shiro.filter;

import com.itluma.myproject.shiro.token.MyToken;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * @author 飞鸟
 * @create 2021-06-15 10:12
 */
public class MyFormAuthenticationFilter extends FormAuthenticationFilter {
    @Override
    protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) {
        String code = request.getParameter("code");
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        MyToken token = new MyToken(username, password, code);
        return token;
    }
}
